<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Document</title>
</head>
<body>
  <h1>用户页面</h1>
  <a href="">新增</a>
  <table border="1" align="center" width="60%">
      <tr>
          <td>商品编号</td>
          <td>商品名称</td>
          <td>商品价格</td>
          <td>商品图片</td>
          <td>操作</td>
      </tr>
      <tr th:each="p : ${productVo}">
          <td th:text="${p.productId}"></td>
          <td th:text="${p.productName}"></td>
          <td th:text="${p.productPrice}"></td>
          <td th:text="${p.productImage}"></td>
          <td>
              <img style="height: 100px "  th:if="${p.realName!=null}" th:src="@{/img/{name}(name=${p.realName})}">
              <a th:if="${p.realName==null}" th:href="@{upload(productId=${p.productId})}">上传图片</a>
          </td>
          <td> 修改
              <a href="javascript:void(0)" th:onclick="del([[${p.productId}]])" >删除</a></td>

      </tr>
  </table>
<script>
    function del(productId){
        var f=confirm("是否确认删除")
        if (f){
            location.href="del?productId="+productId;
        }
    }

</script>
</body>
</html>
